package com.lmt_16;

import sun.security.krb5.internal.crypto.Des;

public class GeneratorAndConsumer {
    public static void main(String[] args) {
        Desk desk = new Desk();

        new Thread(()-> {
            while (true) {
                desk.put();
            }
        },"generator1").start(); // 生产者放东西
        new Thread(()-> {
            while (true) {
                desk.put();
            }
        },"generator2").start(); // 生产者放东西
        new Thread(()-> {
            while (true) {
                desk.put();
            }
        },"generator3").start(); // 生产者放东西
        new Thread(()-> {
            while (true) {
                desk.get();
            }
        },"consumer1").start(); // 消费者放东西
        new Thread(()-> {
            while (true) {
                desk.get();
            }
        },"consumer2").start(); // 消费者放东西

    }
}
